home *** CD-ROM | disk | FTP | other *** search
/ SGI Freeware 2001 May / SGI Freeware 2001 May - Disc 3.iso / dist / fw_squid.idb / usr / freeware / squid / doc / icpv2-application.txt.z / icpv2-application.txt
Text File  |  2000-04-13  |  53KB  |  1,347 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7. Network Working Group                                         D. Wessels
  8. Internet-Draft                                                 K. Claffy
  9.                                          National Laboratory for Applied
  10. Obsoletes <draft-wessels-icp-v2-appl-02.txt>       Network Research/UCSD
  11. Expires: 8 January 1998                                      8 July 1997
  12.  
  13.  
  14.  
  15.         Application of Internet Cache Protocol (ICP), version 2
  16.                    <draft-wessels-icp-v2-appl-03.txt>
  17.  
  18.  
  19. Status of this Memo
  20.  
  21.    This document is an Internet-Draft. Internet-Drafts are working
  22.    documents of the Internet Engineering Task Force (IETF), its areas,
  23.    and its working groups. Note that other groups may also distribute
  24.    working documents as Internet-Drafts.
  25.  
  26.    Internet-Drafts are draft documents valid for a maximum of six months
  27.    and may be updated, replaced, or obsoleted by other documents at any
  28.    time. It is inappropriate to use Internet-Drafts as reference
  29.    material or to cite them other than as ``work in progress.''
  30.  
  31.    To learn the current status of any Internet-Draft, please check the
  32.    ``1id-abstracts.txt'' listing contained in the Internet-Drafts Shadow
  33.    Directories on ftp.is.co.za (Africa), nic.nordu.net (Europe),
  34.    munnari.oz.au (Pacific Rim), ds.internic.net (US East Coast), or
  35.    ftp.isi.edu (US West Coast).
  36.  
  37. Abstract
  38.  
  39.    This document describes the application of ICPv2 (Internet Cache
  40.    Protocol version 2, RFCXXXX) to Web caching.  ICPv2 is a lightweight
  41.    message format used for communication among Web caches.  Several
  42.    independent caching implementations now use ICP[3,5], making it
  43.    important to codify the existing practical uses of ICP for those
  44.    trying to implement, deploy, and extend its use.
  45.  
  46.    ICP queries and replies refer to the existence of URLs (or objects)
  47.    in neighbor caches.  Caches exchange ICP messages and use the
  48.    gathered information to select the most appropriate location from
  49.    which to retrieve an object.  A companion document (RFCXXXX)
  50.    describes the format and syntax of the protocol itself.  In this
  51.    document we focus on issues of ICP deployment, efficiency, security,
  52.    and interaction with other aspects of Web traffic behavior.
  53.  
  54.  
  55.  
  56.  
  57.  
  58. Wessels & Claffy                                                [Page 1]
  59.  
  60. Internet-Draft                                                8 Jul 1997
  61.  
  62.  
  63. Table of Contents
  64.  
  65.    1.   Introduction.................................................  2
  66.    2.   Web Cache Hierarchies........................................  3
  67.    3.   What is the Added Value of ICP?..............................  5
  68.    4.   Example Configuration of ICP Hierarchy.......................  5
  69.      4.1. Configuring the `proxy.customer.org' cache.................  6
  70.      4.2. Configuring the `cache.isp.com' cache......................  6
  71.    5.   Applying the Protocol........................................  7
  72.      5.1. Sending ICP Queries........................................  8
  73.      5.2. Receiving ICP Queries and Sending Replies.................. 10
  74.      5.3. Receiving ICP Replies...................................... 11
  75.      5.4. ICP Options................................................ 13
  76.    6.   Firewalls.................................................... 14
  77.    7.   Multicast.................................................... 15
  78.    8.   Lessons Learned.............................................. 16
  79.      8.1. Differences Between ICP and HTTP........................... 16
  80.      8.2. Parents, Siblings, Hits and Misses......................... 16
  81.      8.3. Different Roles of ICP..................................... 17
  82.      8.4. Protocol Design Flaws of ICPv2............................. 17
  83.    9.   Security Considerations...................................... 18
  84.      9.1. Inserting Bogus ICP Queries................................ 19
  85.      9.2. Inserting Bogus ICP Replies................................ 19
  86.      9.3. Eavesdropping.............................................. 20
  87.      9.4. Blocking ICP Messages...................................... 20
  88.      9.5. Delaying ICP Messages...................................... 20
  89.      9.6. Denial of Service.......................................... 20
  90.      9.7. Altering ICP Fields........................................ 21
  91.      9.8. Summary.................................................... 22
  92.    10.  References................................................... 23
  93.    11.  Acknowledgments.............................................. 24
  94.    12.  Author's Addresses........................................... 24
  95.  
  96.  
  97. 1.  Introduction
  98.  
  99.    ICP is a lightweight message format used for communicating among Web
  100.    caches.  ICP is used to exchange hints about the existence of URLs in
  101.    neighbor caches.  Caches exchange ICP queries and replies to gather
  102.    information for use in selecting the most appropriate location from
  103.    which to retrieve an object.
  104.  
  105.    This document describes the implementation of ICP in software.  For a
  106.    description of the protocol and message format, please refer to the
  107.    companion document (RFCXXXX).  We avoid making judgments about
  108.    whether or how ICP should be used in particular Web caching configu-
  109.    rations.  ICP may be a "net win" in some situations, and a "net loss"
  110.    in others.  We recognize that certain practices described in this
  111.  
  112.  
  113.  
  114. Wessels & Claffy                                                [Page 2]
  115.  
  116. Internet-Draft                                                8 Jul 1997
  117.  
  118.  
  119.    document are suboptimal. Some of these exist for historical reasons.
  120.    Some aspects have been improved in later versions.  Since this docu-
  121.    ment only serves to describe current practices, we focus on document-
  122.    ing rather than evaluating.  However, we do address known security
  123.    problems and other shortcomings.
  124.  
  125.    The remainder of this document is written as follows.  We first
  126.    describe Web cache hierarchies, explain motivation for using ICP, and
  127.    demonstrate how to configure its use in cache hierarchies.  We then
  128.    provide a step-by-step description of an ICP query-response transac-
  129.    tion.  We then discuss ICP interaction with firewalls, and briefly
  130.    touch on multicasting ICP.  We end with lessons with have learned
  131.    during the protocol development and deployement thus far, and the
  132.    canonical security considerations.
  133.  
  134.    ICP was initially developed by Peter Danzig, et. al.  at the Univer-
  135.    sity of Southern California as a central part of hierarchical caching
  136.    in the Harvest research project[3].
  137.  
  138.  
  139. 2.  Web Cache Hierarchies
  140.  
  141.    A single Web cache will reduce the amount of traffic generated by the
  142.    clients behind it.  Similarly, a group of Web caches can benefit by
  143.    sharing another cache in much the same way.  Researchers on the Har-
  144.    vest project envisioned that it would be important to connect Web
  145.    caches hierarchically.  In a cache hierarchy (or mesh) one cache
  146.    establishes peering relationships with its neighbor caches.  There
  147.    are two types of relationship: parent and sibling.  A parent cache is
  148.    essentially one level up in a cache hierarchy.  A sibling cache is on
  149.    the same level.  The terms "neighbor" and "peer" are used to refer to
  150.    either parents or siblings which are a single "cache-hop" away.  Fig-
  151.    ure 1 shows a simple hierarchy configuration.
  152.  
  153.    But what does it mean to be "on the same level" or "one level up?"
  154.    The general flow of document requests is up the hierarchy.  When a
  155.    cache does not hold a requested object, it may ask via ICP whether
  156.    any of its neighbor caches has the object.  If any of the neighbors
  157.    does have the requested object (i.e., a "neighbor hit"), then the
  158.    cache will request it from them.  If none of the neighbors has the
  159.    object (a "neighbor miss"), then the cache must forward the request
  160.    either to a parent, or directly to the origin server.  The essential
  161.    difference between a parent and sibling is that a "neighbor hit" may
  162.    be fetched from either one, but a "neighbor miss" may NOT be fetched
  163.    from a sibling.  In other words, in a sibling relationship, a cache
  164.    can only ask to retrieve objects that the sibling already has cached,
  165.    whereas the same cache can ask a parent to retrieve any object
  166.    regardless of whether or not it is cached.  A parent cache's role is
  167.  
  168.  
  169.  
  170. Wessels & Claffy                                                [Page 3]
  171.  
  172. Internet-Draft                                                8 Jul 1997
  173.  
  174.  
  175.      T H E   I N T E R N E T
  176.    ===========================
  177.        |          ||
  178.        |          ||
  179.        |          ||
  180.        |          ||
  181.        |      +----------------------+
  182.        |      |                      |
  183.        |      |        PARENT        |
  184.        |      |        CACHE         |
  185.        |      |                      |
  186.        |      +----------------------+
  187.        |          ||
  188.      DIRECT       ||
  189.    RETRIEVALS     ||
  190.        |          ||
  191.        |         HITS
  192.        |         AND
  193.        |        MISSES
  194.        |       RESOLVED
  195.        |          ||
  196.        |          ||
  197.        |          ||
  198.        V          \/
  199.    +------------------+                    +------------------+
  200.    |                  |                    |                  |
  201.    |      LOCAL       |/--------HITS-------|     SIBLING      |
  202.    |      CACHE       |\------RESOLVED-----|      CACHE       |
  203.    |                  |                    |                  |
  204.    +------------------+                    +------------------+
  205.       |  |  |  |  |
  206.       |  |  |  |  |
  207.       |  |  |  |  |
  208.       V  V  V  V  V
  209.    ===================
  210.       CACHE CLIENTS
  211.  
  212.    FIGURE 1: A Simple Web cache hierarchy.  The local cache can
  213.    retrieve hits from sibling caches, hits and misses from parent
  214.    caches, and some requests directly from origin servers.
  215.  
  216.    to provide "transit" for the request if necessary, and accordingly
  217.    parent caches are ideally located within or on the way to a transit
  218.    Internet service provider (ISP).
  219.  
  220.    Squid and Harvest allow for complex hierarchical configurations.  For
  221.    example, one could specify that a given neighbor be used for only a
  222.    certain class of requests, such as URLs from a specific DNS domain.
  223.  
  224.  
  225.  
  226. Wessels & Claffy                                                [Page 4]
  227.  
  228. Internet-Draft                                                8 Jul 1997
  229.  
  230.  
  231.    Additionally, it is possible to treat a neighbor as a sibling for
  232.    some requests and as a parent for others.
  233.  
  234.    The cache hierarchy model described here includes a number of fea-
  235.    tures to prevent top-level caches from becoming choke points.  One is
  236.    the ability to restrict parents as just described previously (by
  237.    domains).  Another optimization is that the cache only forwards
  238.    cachable requests to its neighbors.  A large class of Web requests
  239.    are inherently uncachable, including: requests requiring certain
  240.    types of authentication, session-encrypted data, highly personalized
  241.    responses, and certain types of database queries.  Lower level caches
  242.    should handle these requests directly rather than burdening parent
  243.    caches.
  244.  
  245.  
  246. 3.  What is the Added Value of ICP?
  247.  
  248.    Although it is possible to maintain cache hierarchies without using
  249.    ICP, the lack of ICP or something similar prohibits the existence of
  250.    sibling meta-communicative relationships, i.e., mechanisms to query
  251.    nearby caches about a given document.
  252.  
  253.    One concern over the use of ICP is the additional delay that an ICP
  254.    query/reply exchange contributes to an HTTP transaction.  However, if
  255.    the ICP query can locate the object in a nearby neighbor cache, then
  256.    the ICP delay may be more than offset by the faster delivery of the
  257.    data from the neighbor.  In order to minimize ICP delays, the caches
  258.    (as well as the protocol itself) are designed to return ICP requests
  259.    quickly.  Indeed, the application does minimal processing of the ICP
  260.    request, most ICP-related delay is due to transmission on the net-
  261.    work.
  262.  
  263.    ICP also serves to provide an indication of neighbor reachability.
  264.    If ICP replies from a neighbor fail to arrive, then either the net-
  265.    work path is congested (or down), or the cache application is not
  266.    running on the ICP-queried neighbor machine.  In either case, the
  267.    cache should not use this neighbor at this time.  Additionally,
  268.    because an idle cache can turn around the replies faster than a busy
  269.    one, all other things being equal, ICP provides some form of load
  270.    balancing.
  271.  
  272.  
  273. 4.  Example Configuration of ICP Hierarchy
  274.  
  275.    Configuring caches within a hierarchy requires establishing peering
  276.    relationships, which currently involves manual configuration at both
  277.    peering endpoints.  One cache must indicate that the other is a par-
  278.    ent or sibling.  The other cache will most likely have to add the
  279.  
  280.  
  281.  
  282. Wessels & Claffy                                                [Page 5]
  283.  
  284. Internet-Draft                                                8 Jul 1997
  285.  
  286.  
  287.    first cache to its access control lists.
  288.  
  289.    Below we show some sample configuration lines for a hypothetical sit-
  290.    uation.  We have two caches, one operated by an ISP, and another
  291.    operated by a customer.  First we describe how the customer would
  292.    configure his cache to peer with the ISP.  Second, we describe how
  293.    the ISP would allow the customer access to its cache.
  294.  
  295.  
  296. 4.1.  Configuring the `proxy.customer.org' cache
  297.  
  298.    In Squid, to configure parents and siblings in a hierarchy, a
  299.    `cache_host' directive is entered into the configuration file.  The
  300.    format is:
  301.  
  302.        cache_host hostname type http-port icp-port [options]
  303.  
  304.    Where type is either `parent', `sibling', or `multicast'.  For our
  305.    example, it would be:
  306.  
  307.        cache_host cache.isp.com parent 8080 3130
  308.  
  309.    This configuration will cause the customer cache to resolve most
  310.    cache misses through the parent (`cgi-bin' and non-GET requests would
  311.    be resolved directly).  Utilizing the parent may be undesirable for
  312.    certain servers, such as servers also in the customer.org domain.  To
  313.    always handle such local domains directly, the customer would add
  314.    this to his configuration file:
  315.  
  316.        local_domain customer.org
  317.  
  318.    It may also be the case that the customer wants to use the ISP cache
  319.    only for a specific subset of DNS domains.  The need to limit
  320.    requests this way is actually more common for higher levels of cache
  321.    hierarchies, but it is illustrated here nonetheless.  To limit the
  322.    ISP cache to a subset of DNS domains, the customer would use:
  323.  
  324.        cache_host_domain cache.isp.com com net org
  325.  
  326.    Then, any requests which are NOT in the .com, .net, or .org domains
  327.    would be handled directly.
  328.  
  329.  
  330. 4.2.  Configuring the `cache.isp.com' cache
  331.  
  332.    To configure the query-receiving side of the cache peer relationship
  333.    one uses access lists, similar to those used in routing peers.  The
  334.    access lists support a large degree of customization in the peering
  335.  
  336.  
  337.  
  338. Wessels & Claffy                                                [Page 6]
  339.  
  340. Internet-Draft                                                8 Jul 1997
  341.  
  342.  
  343.    relationship.  If there are no access lines present, the cache allows
  344.    the request by default.
  345.  
  346.    Note that the cache.isp.com cache need not explicitly specify the
  347.    customer cache as a peer, nor is the type of relationship encoded
  348.    within the ICP query itself.  The access control entries regulate the
  349.    relationships between this cache and its neighbors.  For our example,
  350.    the ISP would use:
  351.  
  352.        acl src Customer  proxy.customer.org
  353.        http_access allow Customer
  354.        icp_access  allow Customer
  355.  
  356.    This defines an access control entry named `Customer' which specifies
  357.    a source IP address of the customer cache machine.  The customer
  358.    cache would then be allowed to make any request to both the HTTP and
  359.    ICP ports (including cache misses).  This configuration implies that
  360.    the ISP cache is a parent of the customer.
  361.  
  362.    If the ISP wanted to enforce a sibling relationship, it would need to
  363.    deny access to cache misses.  This would be done as follows:
  364.  
  365.        miss_access deny Customer
  366.  
  367.    Of course the ISP should also communicate this to the customer, so
  368.    that the customer will change his configuration from parent to sib-
  369.    ling.  Otherwise, if the customer requests an object not in the ISP
  370.    cache, an error message is generated.
  371.  
  372.  
  373. 5.  Applying the Protocol
  374.  
  375.    The following sections describe the ICP implementation in the Har-
  376.    vest[3] (research version) and Squid Web cache[5] packages.  In terms
  377.    of version numbers, this means version 1.4pl2 for Harvest and version
  378.    1.1.10 for Squid.
  379.  
  380.    The basic sequence of events in an ICP transaction is as follows:
  381.  
  382.    1.   Local cache receives an HTTP[1] request from a cache client.
  383.  
  384.    2.   The local cache sends ICP queries (section 5.1).
  385.  
  386.    3.   The peer cache(s) receive the queries and send ICP replies (sec-
  387.         tion 5.2).
  388.  
  389.    4.   The local cache receives the ICP replies and decides where to
  390.         forward the request (section 5.3).
  391.  
  392.  
  393.  
  394. Wessels & Claffy                                                [Page 7]
  395.  
  396. Internet-Draft                                                8 Jul 1997
  397.  
  398.  
  399. 5.1.  Sending ICP Queries
  400.  
  401.  
  402. 5.1.1.  Determine whether to use ICP at all
  403.  
  404.    Not every HTTP request requires an ICP query to be sent.  Obviously,
  405.    cache hits will not need ICP because the request is satisfied immedi-
  406.    ately.  For origin servers very close to the cache, we do not want to
  407.    use any neighbor caches.  In Squid and Harvest, the administrator
  408.    specifies what constitutes a `local' server with the `local_domain'
  409.    and `local_ip' configuration options.  The cache always contacts a
  410.    local server directly, never querying a peer cache.
  411.  
  412.    There are other classes of requests that the cache (or the adminis-
  413.    trator) may prefer to forward directly to the origin server.  In
  414.    Squid and Harvest, one such class includes all non-GET request meth-
  415.    ods.  A Squid cache can also be configured to not use peers for URLs
  416.    matching the `hierarchy_stoplist'.
  417.  
  418.    In order for an HTTP request to yield an ICP transaction, it must:
  419.  
  420.    o    not be a cache hit
  421.  
  422.    o    not be to a local server
  423.  
  424.    o    be a GET request, and
  425.  
  426.    o    not match the `hierarchy_stoplist' configuration.
  427.  
  428.    We call this a "hierarchical" request.  A "non-hierarchical" request
  429.    is one that doesn't generate any ICP traffic.  To avoid processing
  430.    requests that are likely to lower cache efficiency, one can configure
  431.    the cache to not consult the hierarchy for URLs that contain certain
  432.    strings (e.g. `cgi_bin').
  433.  
  434.  
  435. 5.1.2.  Determine which peers to query
  436.  
  437.    By default, a cache sends an ICP_OP_QUERY message to each peer,
  438.    unless any one of the following are true:
  439.  
  440.    o    Restrictions prevent querying a peer for this request, based on
  441.         the configuration directive `cache_host_domain', which specifies
  442.         a set of DNS domains (from the URLs) for which the peer should
  443.         or should not be queried.  In Squid, a more flexible directive
  444.         ('cache_host_acl') supports restrictions on other parts of the
  445.         request (method, port number, source, etc.).
  446.  
  447.  
  448.  
  449.  
  450. Wessels & Claffy                                                [Page 8]
  451.  
  452. Internet-Draft                                                8 Jul 1997
  453.  
  454.  
  455.    o    The peer is a sibling, and the HTTP request includes a "Pragma:
  456.         no-cache" header.  This is because the sibling would be asked to
  457.         transit the request, which is not allowed.
  458.  
  459.    o    The peer is configured to never be sent ICP queries (i.e. with
  460.         the `no-query' option).
  461.  
  462.    If the determination yields only one queryable ICP peer, and the
  463.    Squid configuration directive `single_parent_bypass' is set, then one
  464.    can bypass waiting for the single ICP response and just send the HTTP
  465.    request directly to the peer cache.
  466.  
  467.    The Squid configuration option `source_ping' configures a Squid cache
  468.    to send a ping to the original source simultaneous with its ICP
  469.    queries, in case the origin is closer than any of the caches.
  470.  
  471.  
  472. 5.1.3.  Calculate the expected number of ICP replies
  473.  
  474.    Harvest and Squid want to maximize the chance to get a HIT reply from
  475.    one of the peers.  Therefore, the cache waits for all ICP replies to
  476.    be received.  Normally, we expect to receive an ICP reply for each
  477.    query sent, except:
  478.  
  479.    o    When the peer is believed to be down.  If the peer is down Squid
  480.         and Harvest continue to send it ICP queries, but do not expect
  481.         the peer to reply.  When an ICP reply is again received from the
  482.         peer, its status will be changed to up.
  483.  
  484.         The determination of up/down status has varied a little bit as
  485.         the Harvest and Squid software evolved.  Both Harvest and Squid
  486.         mark a peer down when it fails to reply to 20 consecutive ICP
  487.         queries.  Squid also marks a peer down when a TCP connection
  488.         fails, and up again when a diagnostic TCP connection succeeds.
  489.  
  490.    o    When sending to a multicast address.  In this case we'll proba-
  491.         bly expect to receive more than one reply, and have no way to
  492.         definitively determine how many to expect.  We discuss multicast
  493.         issues in section 7 below.
  494.  
  495.  
  496. 5.1.4.  Install timeout event
  497.  
  498.    Because ICP uses UDP as underlying transport, ICP queries and replies
  499.    may sometimes be dropped by the network.  The cache installs a time-
  500.    out event in case not all of the expected replies arrive.  By default
  501.    Squid and Harvest use a two-second timeout.  If object retrieval has
  502.    not commenced when the timeout occurs, a source is selected as
  503.  
  504.  
  505.  
  506. Wessels & Claffy                                                [Page 9]
  507.  
  508. Internet-Draft                                                8 Jul 1997
  509.  
  510.  
  511.    described in section 5.3.9 below.
  512.  
  513.  
  514. 5.2.  Receiving ICP Queries and Sending Replies
  515.  
  516.    When an ICP_OP_QUERY message is received, the cache examines it and
  517.    decides which reply message is to be sent.  It will send one of the
  518.    following reply opcodes, tested for use in the order listed:
  519.  
  520.  
  521. 5.2.1.  ICP_OP_ERR
  522.  
  523.    The URL is extracted from the payload and parsed.  If parsing fails,
  524.    an ICP_OP_ERR message is returned.
  525.  
  526.  
  527. 5.2.2.  ICP_OP_DENIED
  528.  
  529.    The access controls are checked.  If the peer is not allowed to make
  530.    this request, ICP_OP_DENIED is returned.  Squid counts the number of
  531.    ICP_OP_DENIED messages sent to each peer.  If more than 95% of more
  532.    than 100 replies have been denied, then no reply is sent at all.
  533.    This prevents misconfigured caches from endlessly sending unnecessary
  534.    ICP messages back and forth.
  535.  
  536.  
  537. 5.2.3.  ICP_OP_HIT
  538.  
  539.    If the cache reaches this point without already matching one of the
  540.    previous  opcodes, it means the request is allowed and we must deter-
  541.    mine if it will be HIT or MISS, so we check if the URL exists in the
  542.    local cache.  If so, and if the cached entry is fresh for at least
  543.    the next 30 seconds, we can return an ICP_OP_HIT message.  The
  544.    stale/fresh determination uses the local refresh (or TTL) rules.
  545.  
  546.    Note that a race condition exists for ICP_OP_HIT replies to sibling
  547.    peers.  The ICP_OP_HIT means that a subsequent HTTP request for the
  548.    named URL would result in a cache hit.  We assume that the HTTP
  549.    request will come very quickly after the ICP_OP_HIT.  However, there
  550.    is a slight chance that the object might be purged from this cache
  551.    before the HTTP request is received.  If this happens, and the reply-
  552.    ing peer has applied Squid's `miss_access' configuration then the
  553.    user will receive a very confusing access denied message.
  554.  
  555.  
  556. 5.2.3.1.  ICP_OP_HIT_OBJ
  557.  
  558.    Before returning the ICP_OP_HIT message, we see if we can send an
  559.  
  560.  
  561.  
  562. Wessels & Claffy                                               [Page 10]
  563.  
  564. Internet-Draft                                                8 Jul 1997
  565.  
  566.  
  567.    ICP_OP_HIT_OBJ message instead.  We can use ICP_OP_HIT_OBJ if:
  568.  
  569.    o    The ICP_OP_QUERY message had the ICP_FLAG_HIT_OBJ flag set.
  570.  
  571.    o    The entire object (plus URL) will fit in an ICP message.  The
  572.         maximum ICP message size is 16 Kbytes, but an application may
  573.         choose to set a smaller maximum value for ICP_OP_HIT_OBJ
  574.         replies.
  575.  
  576.    Normally ICP replies are sent immediately after the query is
  577.    received, but the ICP_OP_HIT_OBJ message cannot be sent until the
  578.    object data is available to copy into the reply message.  For Squid
  579.    and Harvest this means the object must be "swapped in" from disk if
  580.    it is not already in memory.  Therefore, on average, an
  581.    ICP_OP_HIT_OBJ reply will have higher latency than ICP_OP_HIT.
  582.  
  583.  
  584. 5.2.4.  ICP_OP_MISS_NOFETCH
  585.  
  586.    At this point we have a cache miss.  ICP has two types of miss
  587.    replies.  If the cache does not want the peer to request the object
  588.    from it, it sends an ICP_OP_MISS_NOFETCH message.
  589.  
  590.  
  591. 5.2.5.  ICP_OP_MISS
  592.  
  593.    Finally, an ICP_OP_MISS reply is returned as the default.  If the
  594.    replying cache is a parent of the querying cache, the ICP_OP_MISS
  595.    indicates an invitation to fetch the URL through the replying cache.
  596.  
  597.  
  598. 5.3.  Receiving ICP Replies
  599.  
  600.    Some ICP replies will be ignored; specifically, when any of the fol-
  601.    lowing are true:
  602.  
  603.    o    The reply message originated from an unknown peer.
  604.  
  605.    o    The object named by the URL does not exist.
  606.  
  607.    o    The object is already being fetched.
  608.  
  609.  
  610. 5.3.1.  ICP_OP_DENIED
  611.  
  612.    If more than 95% of more than 100 replies from a peer cache have been
  613.    ICP_OP_DENIED, then such a high denial rate most likely indicates a
  614.    configuration error, either locally or at the peer.  For this reason,
  615.  
  616.  
  617.  
  618. Wessels & Claffy                                               [Page 11]
  619.  
  620. Internet-Draft                                                8 Jul 1997
  621.  
  622.  
  623.    no further queries will be sent to the peer for the duration of the
  624.    cache process.
  625.  
  626.  
  627. 5.3.2.  ICP_OP_HIT
  628.  
  629.    Object retrieval commences immediately from the replying peer.
  630.  
  631.  
  632. 5.3.3.  ICP_OP_HIT_OBJ
  633.  
  634.    The object data is extracted from the ICP message and the retrieval
  635.    is complete.  If there is some problem with the ICP_OP_HIT_OBJ mes-
  636.    sage (e.g. missing data) the reply will be treated like a standard
  637.    ICP_OP_HIT.
  638.  
  639.  
  640. 5.3.4.  ICP_OP_SECHO
  641.  
  642.    Object retrieval commences immediately from the origin server because
  643.    the ICP_OP_SECHO reply arrived prior to any ICP_OP_HIT's.  If an
  644.    ICP_OP_HIT had arrived prior, this ICP_OP_SECHO reply would be
  645.    ignored because the retrieval has already started.
  646.  
  647.  
  648. 5.3.5.  ICP_OP_DECHO
  649.  
  650.    An ICP_OP_DECHO reply is handled like an ICP_OP_MISS.  Non-ICP peers
  651.    must always be configured as parents; a non-ICP sibling makes no
  652.    sense.  One serious problem with the ICP_OP_DECHO feature is that
  653.    since it bounces messages off the peer's UDP echo port, it does not
  654.    indicate that the peer cache is actually running -- only that network
  655.    connectivity exists between the pair.
  656.  
  657.  
  658. 5.3.6.  ICP_OP_MISS
  659.  
  660.    If the peer is a sibling, the ICP_OP_MISS reply is ignored.  Other-
  661.    wise, the peer may be "remembered" for future use in case no HIT
  662.    replies are received later (section 5.3.9).
  663.  
  664.    Harvest and Squid remember the first parent to return an ICP_OP_MISS
  665.    message.  With Squid, the parents may be weighted so that the "first
  666.    parent to miss" may not actually be the first reply received.  We
  667.    call this the FIRST_PARENT_MISS.  Remember that sibling misses are
  668.    entirely ignored, we only care about misses from parents.  The parent
  669.    miss RTT's can be weighted because sometimes the closest parent is
  670.    not the one people want to use.
  671.  
  672.  
  673.  
  674. Wessels & Claffy                                               [Page 12]
  675.  
  676. Internet-Draft                                                8 Jul 1997
  677.  
  678.  
  679.    Also, recent versions of Squid may remember the parent with the low-
  680.    est RTT to the origin server, using the ICP_FLAG_SRC_RTT option.  We
  681.    call this the CLOSEST_PARENT_MISS.
  682.  
  683.  
  684. 5.3.7.  ICP_OP_MISS_NOFETCH
  685.  
  686.    This reply is essentially ignored.  A cache must not forward a
  687.    request to a peer that returns ICP_OP_MISS_NOFETCH.
  688.  
  689.  
  690. 5.3.8.  ICP_OP_ERR
  691.  
  692.    Silently ignored.
  693.  
  694.  
  695. 5.3.9.  When all peers MISS.
  696.  
  697.    For ICP_OP_HIT and ICP_OP_SECHO the request is forwarded immediately.
  698.    For ICP_OP_HIT_OBJ there is no need to forward the request.  For all
  699.    other reply opcodes, we wait until the expected number of replies
  700.    have been received.  When we have all of the expected replies, or
  701.    when the query timeout occurs, it is time to forward the request.
  702.  
  703.    Since MISS replies were received from all peers, we must either
  704.    select a parent cache or the origin server.
  705.  
  706.    o    If the peers are using the ICP_FLAG_SRC_RTT feature, we forward
  707.         the request to the peer with the lowest RTT to the origin
  708.         server.  If the local cache is also measuring RTT's to origin
  709.         servers, and is closer than any of the parents, the request is
  710.         forwarded directly to the origin server.
  711.  
  712.    o    If there is a FIRST_PARENT_MISS parent available, the request
  713.         will be forwarded there.
  714.  
  715.    o    If the ICP query/reply exchange did not produce any appropriate
  716.         parents, the request will be sent directly to the origin server
  717.         (unless firewall restrictions prevent it).
  718.  
  719.  
  720. 5.4.  ICP Options
  721.  
  722.    The following options were added to Squid to support some new fea-
  723.    tures while maintaining backward compatibility with the Harvest
  724.    implementation.
  725.  
  726.  
  727.  
  728.  
  729.  
  730. Wessels & Claffy                                               [Page 13]
  731.  
  732. Internet-Draft                                                8 Jul 1997
  733.  
  734.  
  735. 5.4.1.  ICP_FLAG_HIT_OBJ
  736.  
  737.    This flag is off by default and will be set in an ICP_OP_QUERY mes-
  738.    sage only if these three criteria are met:
  739.  
  740.    o    It is enabled in the cache configuration file with `udp_hit_obj
  741.         on'.
  742.  
  743.    o    The peer must be using ICP version 2.
  744.  
  745.    o    The HTTP request must not include the "Pragma: no-cache" header.
  746.  
  747.  
  748. 5.4.2.  ICP_FLAG_SRC_RTT
  749.  
  750.    This flag is off by default and will be set in an ICP_OP_QUERY mes-
  751.    sage only if these two criteria are met:
  752.  
  753.    o    It is enabled in the cache configuration file with `query_icmp
  754.         on'.
  755.  
  756.    o    The peer must be using ICP version 2.
  757.  
  758.  
  759. 6.  Firewalls
  760.  
  761.    Operating a Web cache behind a firewall or in a private network poses
  762.    some interesting problems.  The hard part is figuring out whether the
  763.    cache is able to connect to the origin server.  Harvest and Squid
  764.    provide an `inside_firewall' configuration directive to list DNS
  765.    domains on the near side of a firewall.  Everything else is assumed
  766.    to be on the far side of a firewall.  Squid also has a `firewall_ip'
  767.    directive so that inside hosts can be specified by IP addresses as
  768.    well.
  769.  
  770.    In a simple configuration, a Squid cache behind a firewall will have
  771.    only one parent cache (which is on the firewall itself).  In this
  772.    case, Squid must use that parent for all servers beyond the firewall,
  773.    so there is no need to utilize ICP.
  774.  
  775.    In a more complex configuration, there may be a number of peer caches
  776.    also behind the firewall.  Here, ICP may be used to check for cache
  777.    hits in the peers.  Occasionally, when ICP is being used, there may
  778.    not be any replies received.  If the cache were not behind a fire-
  779.    wall, the request would be forwarded directly to the origin server.
  780.    But in this situation, the cache must pick a parent cache, either
  781.    randomly or due to configuration information.  For example, Squid
  782.    allows a parent cache to be designated as a default choice when no
  783.  
  784.  
  785.  
  786. Wessels & Claffy                                               [Page 14]
  787.  
  788. Internet-Draft                                                8 Jul 1997
  789.  
  790.  
  791.    others are available.
  792.  
  793.  
  794. 7.  Multicast
  795.  
  796.    For efficient distribution, a cache may deliver ICP queries to a mul-
  797.    ticast address, and neighbor caches may join the multicast group to
  798.    receive such queries.
  799.  
  800.    Current practice is that caches send ICP replies only to unicast
  801.    addresses, for several reasons:
  802.  
  803.    o    Multicasting ICP replies would not reduce the number of packets
  804.         sent.
  805.  
  806.    o    It prevents other group members from receiving unexpected
  807.         replies.
  808.  
  809.    o    The reply should follow unicast routing paths to indicate (uni-
  810.         cast) connectivity between the receiver and the sender since the
  811.         subsequent HTTP request will be unicast routed.
  812.  
  813.  
  814.    Trust is an important aspect of inter-cache relationships.  A Web
  815.    cache should not automatically trust any cache which replies to a
  816.    multicast ICP query.  Caches should ignore ICP messages from
  817.    addresses not specifically configured as neighbors.  Otherwise, one
  818.    could easily pollute a cache mesh by running an illegitimate cache
  819.    and having it join a group, return ICP_OP_HIT for all requests, and
  820.    then deliver bogus content.
  821.  
  822.    When sending to multicast groups, cache administrators must be care-
  823.    ful to use the minimum multicast TTL required to reach all group mem-
  824.    bers.  Joining a multicast group requires no special privileges and
  825.    there is no way to prevent anyone from joining "your" group.  Two
  826.    groups of caches utilizing the same multicast address could overlap,
  827.    which would cause a cache to receive ICP replies from unknown neigh-
  828.    bors.  The unknown neighbors would not be used to retrieve the object
  829.    data, but the cache would constantly receive ICP replies that it must
  830.    always ignore.
  831.  
  832.    To prevent an overlapping cache mesh, caches should thus limit the
  833.    scope of their ICP queries with appropriate TTLs; an application such
  834.    as mtrace[6] can determine appropriate multicast TTLs.
  835.  
  836.    As mentioned in section 5.1.3, we need to estimate the number of
  837.    expected replies for an ICP_OP_QUERY message.  For unicast we expect
  838.    one reply for each query if the peer is up.  However, for multicast
  839.  
  840.  
  841.  
  842. Wessels & Claffy                                               [Page 15]
  843.  
  844. Internet-Draft                                                8 Jul 1997
  845.  
  846.  
  847.    we generally expect more than one reply, but have no way of knowing
  848.    exactly how many replies to expect.  Squid regularly (every 15 min-
  849.    utes) sends out test ICP_OP_QUERY messages to only the multicast
  850.    group peers.  As with a real ICP query, a timeout event is installed
  851.    and the replies are counted until the timeout occurs.  We have found
  852.    that the received count varies considerably.  Therefore, the number
  853.    of replies to expect is calculated as a moving average, rounded down
  854.    to the nearest integer.
  855.  
  856.  
  857. 8.  Lessons Learned
  858.  
  859.  
  860. 8.1.  Differences Between ICP and HTTP
  861.  
  862.    ICP is notably different from HTTP.  HTTP supports a rich and sophis-
  863.    ticated set of features.  In contrast, ICP was designed to be simple,
  864.    small, and efficient.  HTTP request and reply headers consist of
  865.    lines of ASCII text delimited by a CRLF pair, whereas ICP uses a
  866.    fixed size header and represents numbers in binary.  The only thing
  867.    ICP and HTTP have in common is the URL.
  868.  
  869.    Note that the ICP message does not even include the HTTP request
  870.    method.  The original implementation assumed that only GET requests
  871.    would be cachable and there would be no need to locate non-GET
  872.    requests in neighbor caches.  Thus, the current version of ICP does
  873.    not accommodate non-GET requests, although the next version of this
  874.    protocol will likely include a field for the request method.
  875.  
  876.    HTTP defines features that are important for caching but not express-
  877.    ible with the current ICP protocol.  Among these are Pragma: no-
  878.    cache, If-Modified-Since, and all of the Cache-Control features of
  879.    HTTP/1.1.  An ICP_OP_HIT_OBJ message may deliver an object which may
  880.    not obey all of the request header constraints.  These differences
  881.    between ICP and HTTP are the reason we discourage the use of the
  882.    ICP_OP_HIT_OBJ feature.
  883.  
  884.  
  885. 8.2.  Parents, Siblings, Hits and Misses
  886.  
  887.    Note that the ICP message does not have a field to indicate the
  888.    intent of the querying cache.  That is, nowhere in the ICP request or
  889.    reply does it say that the two caches have a sibling or parent rela-
  890.    tionship.  A sibling cache can only respond with HIT or MISS, not
  891.    "you can retrieve this from me" or "you can not retrieve this from
  892.    me."  The querying cache must apply the HIT or MISS reply to its
  893.    local configuration to prevent it from resolving misses through a
  894.    sibling cache.  This constraint is awkward, because this aspect of
  895.  
  896.  
  897.  
  898. Wessels & Claffy                                               [Page 16]
  899.  
  900. Internet-Draft                                                8 Jul 1997
  901.  
  902.  
  903.    the relationship can be configured only in the cache originating the
  904.    requests, and indirectly via the access controls configured in the
  905.    queried cache as described earlier in section 4.2.
  906.  
  907.  
  908. 8.3.  Different Roles of ICP
  909.  
  910.    There are two different understandings of what exactly the role of
  911.    ICP is in a cache mesh.  One understanding is that ICP's role is only
  912.    object location, specifically, to provide hints about whether or not
  913.    a named object exists in a neighbor cache.  An implied assumption is
  914.    that cache hits are highly desirable, and ICP is used to maximize the
  915.    chance of getting them.  If an ICP message is lost due to congestion,
  916.    then nothing significant is lost; the request will be satisfied
  917.    regardless.
  918.  
  919.    ICP is increasingly being tasked to fill a more complex role: convey-
  920.    ing cache usage policy.  For example, many organizations (e.g. uni-
  921.    versities) will install a Web cache on the border of their network.
  922.    Such organizations may be happy to establish sibling relationships
  923.    with other, nearby caches, subject to the following terms:
  924.  
  925.    o    Any of the organization's customers or users may request any
  926.         object (cached or not).
  927.  
  928.    o    Anyone may request an object already in the cache.
  929.  
  930.    o    Anyone may request any object from the organization's servers
  931.         behind the cache.
  932.  
  933.    o    All other requests are denied; specifically, the organization
  934.         will not provide transit for requests in which neither the
  935.         client nor the server falls within its domain.
  936.  
  937.    To successfully convey policy the ICP exchange must very accurately
  938.    predict the result (hit, miss) of a subsequent HTTP request.  The
  939.    result may often depend on other request fields, such as Cache-Con-
  940.    trol.  So it's not possible for ICP to accurately predict the result
  941.    without more, or perhaps all, of the HTTP request.
  942.  
  943.  
  944. 8.4.  Protocol Design Flaws of ICPv2
  945.  
  946.    We recognize certain flaws with the original design of ICP, and make
  947.    note of them so that future versions can avoid the same mistakes.
  948.  
  949.    o    The NULL-terminated URL in the payload field requires stepping
  950.         through the message an octet at a time to find some of the
  951.  
  952.  
  953.  
  954. Wessels & Claffy                                               [Page 17]
  955.  
  956. Internet-Draft                                                8 Jul 1997
  957.  
  958.  
  959.         fields (i.e. the beginning of object data in an ICP_OP_HIT_OBJ
  960.         message).
  961.  
  962.    o    Two fields (Sender Host Address and Requester Host Address) are
  963.         IPv4 specific.  However, neither of these fields are used in
  964.         practice; they are normally zero-filled.  If IP addresses have a
  965.         role in the ICP message, there needs to be an address family
  966.         descriptor for each address, and clients need to be able to say
  967.         whether they want to hear IPv6 responses or not.
  968.  
  969.    o    Options are limited to 32 option flags and 32 bits of option
  970.         data.  This should be more like TCP, with an option descriptor
  971.         followed by option data.
  972.  
  973.    o    Although currently used as the cache key, the URL string no
  974.         longer serves this role adequately.  Some HTTP responses now
  975.         vary according to the requestor's User-Agent and other headers.
  976.         A cache key must incorporate all non-transport headers present
  977.         in the client's request.  All non-hop-by-hop request headers
  978.         should be sent in an ICP query.
  979.  
  980.    o    ICPv2 uses different opcode values for queries and responses.
  981.         ICP should use the same opcode for both sides of a two-sided
  982.         transaction, with a "query/response" indicator telling which
  983.         side is which.
  984.  
  985.    o    ICPv2 does not include any authentication fields.
  986.  
  987.  
  988. 9.  Security Considerations
  989.  
  990.    Security is an issue with ICP over UDP because of its connectionless
  991.    nature.  Below we consider various vulnerabilities and methods of
  992.    attack, and their implications.
  993.  
  994.    Our first line of defense is to check the source IP address of the
  995.    ICP message, e.g. as given by recvfrom(2).  ICP query messages should
  996.    be processed if the access control rules allow the querying address
  997.    access to the cache.  However, ICP reply messages must only be
  998.    accepted from known neighbors; a cache must ignore replies from
  999.    unknown addresses.
  1000.  
  1001.    Because we trust the validity of an address in an IP packet, ICP is
  1002.    susceptible to IP address spoofing.  In this document we address some
  1003.    consequences of IP address spoofing.  Normally, spoofed addresses can
  1004.    only be detected by routers, not by hosts.  However, the IP Authenti-
  1005.    cation Header[7,8] can be used underneath ICP to provide crypto-
  1006.    graphic authentication of the entire IP packet containing the ICP
  1007.  
  1008.  
  1009.  
  1010. Wessels & Claffy                                               [Page 18]
  1011.  
  1012. Internet-Draft                                                8 Jul 1997
  1013.  
  1014.  
  1015.    protocol, thus eliminating the risk of IP address spoofing.
  1016.  
  1017.  
  1018. 9.1.  Inserting Bogus ICP Queries
  1019.  
  1020.    Processing an ICP_OP_QUERY message has no known security implica-
  1021.    tions, so long as the requesting address is granted access to the
  1022.    cache.
  1023.  
  1024.  
  1025. 9.2.  Inserting Bogus ICP Replies
  1026.  
  1027.    Here we are concerned with a third party generating ICP reply mes-
  1028.    sages which are returned to the querying cache before the real reply
  1029.    arrives, or before any replies arrive.  The third party may insert
  1030.    bogus ICP replies which appear to come from legitimate neighbors.
  1031.    There are three vulnerabilities:
  1032.  
  1033.    o    Preventing a certain neighbor from being used
  1034.  
  1035.         If a third-party could send an ICP_OP_MISS_NOFETCH reply back
  1036.         before the real reply arrived, the (falsified) neighbor would
  1037.         not be used.
  1038.  
  1039.         A third-party could blast a cache with ICP_OP_DENIED messages
  1040.         until the threshold described in section 5.3.1 is reached,
  1041.         thereby causing the neighbor relationship to be temporarily ter-
  1042.         minated.
  1043.  
  1044.    o    Forcing a certain neighbor to be used
  1045.  
  1046.         If a third-party could send an ICP_OP_HIT reply back before the
  1047.         real reply arrived, the (falsified) neighbor would be used.
  1048.         This may violate the terms of a sibling relationship; ICP_OP_HIT
  1049.         replies mean a subsequent HTTP request will also be a hit.
  1050.  
  1051.         Similarly, if bogus ICP_OP_SECHO messages can be generated, the
  1052.         cache would retrieve requests directly from the origin server.
  1053.  
  1054.    o    Cache poisoning
  1055.  
  1056.         The ICP_OP_HIT_OBJ message is especially sensitive to security
  1057.         issues since it contains actual object data.  In combination
  1058.         with IP address spoofing, this option opens up the likely possi-
  1059.         bility of having the cache polluted with invalid objects.
  1060.  
  1061.  
  1062.  
  1063.  
  1064.  
  1065.  
  1066. Wessels & Claffy                                               [Page 19]
  1067.  
  1068. Internet-Draft                                                8 Jul 1997
  1069.  
  1070.  
  1071. 9.3.  Eavesdropping
  1072.  
  1073.    Multicasting ICP queries provides a very simple method for others to
  1074.    "snoop" on ICP messages.  If enabling multicast, cache administrators
  1075.    should configure the application to use the minimum required multi-
  1076.    cast TTL, using a tool such as mtrace[6].  Note that the IP Encapsu-
  1077.    lating Security Payload [7,9] mechanism can be used to provide pro-
  1078.    tection against eavesdropping of ICP messages.
  1079.  
  1080.    Eavesdropping on ICP traffic can provide third parties with a list of
  1081.    URLs being browsed by cache users.  Because the Requestor Host
  1082.    Address is zero-filled by Squid and Harvest, the URLs cannot be
  1083.    mapped back to individual host systems.
  1084.  
  1085.    By default, Squid and Harvest do not send ICP messages for URLs con-
  1086.    taining `cgi-bin' or `?'.  These URLs sometimes contain sensitive
  1087.    information as argument parameters.  Cache administrators need to be
  1088.    aware that altering the configuration to make ICP queries for such
  1089.    URLs may expose sensitive information to outsiders, especially when
  1090.    multicast is used.
  1091.  
  1092.  
  1093. 9.4.  Blocking ICP Messages
  1094.  
  1095.    Intentionally blocked (or discarded) ICP queries or replies will
  1096.    appear to reflect link failure or congestion, and will prevent the
  1097.    use of a neighbor as well as lead to timeouts (see section 5.1.4).
  1098.    If all messages are blocked, the cache will assume the neighbor is
  1099.    down and remove it from the selection algorithm.  However, if, for
  1100.    example, every other query is blocked, the neighbor will remain
  1101.    "alive," but every other request will suffer the ICP timeout.
  1102.  
  1103.  
  1104. 9.5.  Delaying ICP Messages
  1105.  
  1106.    The neighbor selection algorithm normally waits for all ICP MISS
  1107.    replies to arrive.  Delaying queries or replies, so that they arrive
  1108.    later than they normally would, will cause additional delay for the
  1109.    subsequent HTTP request.  Of course, if messages are delayed so that
  1110.    they arrive after the timeout, the behavior is the same as "blocking"
  1111.    above.
  1112.  
  1113.  
  1114. 9.6.  Denial of Service
  1115.  
  1116.    A denial-of-service attack, where the ICP port is flooded with a con-
  1117.    tinuous stream of bogus messages has three vulnerabilities:
  1118.  
  1119.  
  1120.  
  1121.  
  1122. Wessels & Claffy                                               [Page 20]
  1123.  
  1124. Internet-Draft                                                8 Jul 1997
  1125.  
  1126.  
  1127.    o    The application may log every bogus ICP message and eventually
  1128.         fill up a disk partition.
  1129.  
  1130.    o    The socket receive queue may fill up, causing legitimate mes-
  1131.         sages to be dropped.
  1132.  
  1133.    o    The host may waste some CPU cycles receiving the bogus messages.
  1134.  
  1135.  
  1136. 9.7.  Altering ICP Fields
  1137.  
  1138.    Here we assume a third party is able to change one or more of the ICP
  1139.    reply message fields.
  1140.  
  1141.    Opcode
  1142.  
  1143.       Changing the opcode field is much like inserting bogus messages
  1144.       described above.  Changing a hit to a miss would prevent the peer
  1145.       from being used.  Changing a miss to a hit would force the peer to
  1146.       be used.
  1147.  
  1148.    Version
  1149.  
  1150.       Altering the ICP version field may have unpredictable consequences
  1151.       if the new version number is recognized and supported.  The
  1152.       receiving application should ignore messages with invalid version
  1153.       numbers.  At the time of this writing, both version numbers 2 and
  1154.       3 are in use.  These two versions use some fields (e.g. Options)
  1155.       in a slightly different manner.
  1156.  
  1157.    Message Length
  1158.  
  1159.       An incorrect message length should be detected by the receiving
  1160.       application as an invalid ICP message.
  1161.  
  1162.    Request Number
  1163.  
  1164.       The request number is often used as a part of the cache key.  Har-
  1165.       vest does not use the request number.  Squid uses the request num-
  1166.       ber in conjunction with the URL to create a cache key.  Altering
  1167.       the request number will cause a lookup of the cache key to fail.
  1168.       This is similar to blocking the ICP reply altogether.
  1169.  
  1170.       There is no requirement that a cache use both the URL and the
  1171.       request number to locate HTTP requests with outstanding ICP
  1172.       queries (however both Squid and Harvest do).  The request number
  1173.       must always be the same in the query and the reply.  However, if
  1174.       the querying cache uses only the request number to locate pending
  1175.  
  1176.  
  1177.  
  1178. Wessels & Claffy                                               [Page 21]
  1179.  
  1180. Internet-Draft                                                8 Jul 1997
  1181.  
  1182.  
  1183.       requests, there is some possibility that a replying cache might
  1184.       increment the request number in the reply to give the false
  1185.       impression that the two caches are closer than they really are.
  1186.       In other words, assuming that there are a few ICP requests "in
  1187.       flight" at any given time, incrementing the reply request number
  1188.       trick the querying cache into seeing a smaller round-trip time
  1189.       than really exists.
  1190.  
  1191.    Options
  1192.  
  1193.       There is little risk in having the Options bitfields altered.  Any
  1194.       option bit must only be set in a reply if it was also set in a
  1195.       query.  Changing a bit from clear to set is detectable by the
  1196.       querying cache, and such a message must be ignored.  Changing a
  1197.       bit from set to clear is allowed and has no negative side effects.
  1198.  
  1199.    Option Data
  1200.  
  1201.       ICP_FLAG_SRC_RTT is the only option which uses the Option Data
  1202.       field.  Altering the RTT values returned here can affect the
  1203.       neighbor selection algorithm, either forcing or preventing the use
  1204.       of a neighbor.
  1205.  
  1206.    URL
  1207.  
  1208.       The URL and Request Number are used to generate the cache key.
  1209.       Altering the URL will cause a lookup of the cache key to fail, and
  1210.       the ICP reply to be entirely ignored.  This is similar to blocking
  1211.       the ICP reply altogether.
  1212.  
  1213.  
  1214. 9.8.  Summary
  1215.  
  1216.    o    ICP_OP_HIT_OBJ is particularly vulnerable to security problems
  1217.         because it includes object data.  For this, and other reasons,
  1218.         its use is discouraged.
  1219.  
  1220.    o    Falsifying, altering, inserting, or blocking ICP messages can
  1221.         cause an HTTP request to fail only in two situations:
  1222.  
  1223.         -    If the cache is behind a firewall and cannot directly con-
  1224.              nect to the origin server.
  1225.  
  1226.         -    If a false ICP_OP_HIT reply causes the HTTP request to be
  1227.              forwarded to a sibling, where the request is a cache miss
  1228.              and the sibling refuses to continue forwarding the request
  1229.              on behalf of the originating cache.
  1230.  
  1231.  
  1232.  
  1233.  
  1234. Wessels & Claffy                                               [Page 22]
  1235.  
  1236. Internet-Draft                                                8 Jul 1997
  1237.  
  1238.  
  1239.    o    Falsifying, altering, inserting, or blocking ICP messages can
  1240.         easily cause HTTP requests to be forwarded (or not forwarded) to
  1241.         certain neighbors.  If the neighbor cache has also been compro-
  1242.         mised, then it could serve bogus content and pollute a cache
  1243.         hierarchy.
  1244.  
  1245.    o    Blocking or delaying ICP messages can cause HTTP request to be
  1246.         further delayed, but still satisfied.
  1247.  
  1248.  
  1249.  
  1250. 10.  References
  1251.  
  1252.    [1] Fielding, R., et. al, "Hypertext Transfer Protocol -- HTTP/1.1",
  1253.    RFC 2068, UC Irvine, January 1997.
  1254.  
  1255.    [2] Berners-Lee, T., Masinter, L., and M. McCahill, "Uniform Resource
  1256.    Locators (URL)", RFC 1738, CERN, Xerox PARC, University of Minnesota,
  1257.    December 1994.
  1258.  
  1259.    [3] Bowman M., Danzig P., Hardy D., Manber U., Schwartz M., and Wes-
  1260.    sels D., "The Harvest Information Discovery and Access System",
  1261.    Internet Research Task Force - Resource Discovery, http://har-
  1262.    vest.transarc.com/.
  1263.  
  1264.    [4] Wessels D., Claffy K., "ICP and the Squid Web Cache", National
  1265.    Laboratory for Applied Network Research, http://www.nlanr.net/~wes-
  1266.    sels/Papers/icp-squid.ps.gz.
  1267.  
  1268.    [5] Wessels D., "The Squid Internet Object Cache", National Labora-
  1269.    tory for Applied Network Research, http://squid.nlanr.net/Squid/
  1270.  
  1271.    [6] mtrace, Xerox PARC, ftp://ftp.parc.xerox.com/pub/net-
  1272.    research/ipmulti/.
  1273.  
  1274.    [7] Atkinson, R., "Security Architecture for the Internet Protocol",
  1275.    RFC 1825, NRL, August 1995.
  1276.  
  1277.    [8] Atkinson, R., "IP Authentication Header", RFC 1826, NRL, August
  1278.    1995.
  1279.  
  1280.    [9] Atkinson, R., "IP Encapsulating Security Payload (ESP)", RFC
  1281.    1827, NRL, August 1995.
  1282.  
  1283.  
  1284.  
  1285.  
  1286.  
  1287.  
  1288.  
  1289.  
  1290. Wessels & Claffy                                               [Page 23]
  1291.  
  1292. Internet-Draft                                                8 Jul 1997
  1293.  
  1294.  
  1295. 11.  Acknowledgments
  1296.  
  1297.    The authors wish to thank Paul A Vixie <paul@vix.com> for
  1298.    providing excellent feedback on this document,
  1299.    Martin Hamilton <martin@mrrl.lut.ac.uk> for pushing the
  1300.    development of multicast ICP, Eric Rescorla <ekr@terisa.com>
  1301.    and Randall Atkinson <rja@home.net> for assisting with security issues,
  1302.    and especially Allyn Romanow for keeping us on the right track.
  1303.  
  1304.  
  1305. 12.  Authors' Addresses:
  1306.  
  1307.    Duane Wessels
  1308.    National Laboratory for Applied Network Research
  1309.    10100 Hopkins Drive
  1310.    La Jolla, CA 92093
  1311.    wessels@nlanr.net
  1312.  
  1313.    K Claffy
  1314.    National Laboratory for Applied Network Research
  1315.    10100 Hopkins Drive
  1316.    La Jolla, CA 92093
  1317.    kc@nlanr.net
  1318.  
  1319.  
  1320.  
  1321.  
  1322.  
  1323.  
  1324.  
  1325.  
  1326.  
  1327.  
  1328.  
  1329.  
  1330.  
  1331.  
  1332.  
  1333.  
  1334.  
  1335.  
  1336.  
  1337.  
  1338.  
  1339.  
  1340.  
  1341.  
  1342.  
  1343.  
  1344.  
  1345.  
  1346. Wessels & Claffy                                               [Page 24]
  1347.